import React from "react";
import NoticeTable from './NoticeTable'
import ActivityTable from './ActivityTable'
import FileTable from "../IndexManage/FileTable";

export default class AutoTable extends React.Component{
    constructor(props) {
        super(props);
    }

    UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
        console.log("UNSAFE_componentWillReceiveProps(nextProps, nextContext)",nextProps)
    }

    render() {
        let type = this.props.match.params.type;
        let id = null
        if(type!="notice"&&type!="activity"){
            let tmpArr = type.split("&")
            //type 为 folder 或者 file-d
            if(tmpArr[0]=="file"){
                type = "file-d"
            }else if(tmpArr[0]=="article"){
                type = "article-d"
            }else type = "folder"
            id = tmpArr[1]
        }
        return (
            <div className="decorate" style={{height:"100%"}}>
                {type=="notice" ? <NoticeTable></NoticeTable> : (type=="activity" ? <ActivityTable/> : (type=="folder" || type=="file-d" || type=="article-d" ? <FileTable type={type} data={id}/> : null)) }
            </div>
        )
    }
}
